第 6 步:很好!我们有我们的数据。让我们创建一个点击事件,我们可以在创建精灵时附加到它们!

  • ,在上面写着: MAIN FUNCTION的地方拖入Define Function with Docstring
  • my_function()重命名为add_click_event()
  • 将新函数的文档字符串更改为: """Attaches a click event to a sprite"""
  • 将以下参数添加到add_click_event()sprite , my_display , my_dictionary

To navigate the page using the TAB key, first press ESC to exit the code editor.

# THIS ACTIVITY IS IN PREVIEW ONLY MODE
  • Run Code
  • Submit Work
  • Next Activity
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)